package com.vb.controller;

import com.vb.service.CableShopService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import static com.vb.utils.SearchUtil.ossUpload;

@RestController
@AllArgsConstructor
@RequestMapping("/vr")
public class VRController {

    private final CableShopService cableShopService;

    /*文件入库请求*/
    @PostMapping("/upload")
    public HashMap<String, String> uploadFile(MultipartFile file) throws IOException {
        return ossUpload(file);
    }



    /*文件检索请求*/
    @PostMapping("/search")
    public Map<String,Object> searchFile(@RequestBody String base64String) throws IOException {
        /*将返回值，中的图片路径取出，然后在库中检索路径相同的数据，将数据返回给前端做展示，此处要展示几条？*/
        return cableShopService.getSearchShop(base64String);
    }

}
